<%@page import="systems.ConfigSystem"%>
<%@page import="entities.SiteConfig"%>
<%@page import="entities.Category"%>
<%@page import="java.util.List"%>
<%@page import="helpers.UrlHelper"%>
<%
List<Category> categories = (List<Category>) request.getAttribute("categories");
SiteConfig siteConfig = ConfigSystem.getConfigs();
%>
<jsp:include page="/templates/classic/layouts/header.jsp" />

		<h2 class="title">Link Directory</h2>
		<br />
		<div class="cats">
			<% 
			int count = 0;
			int num = 0;
			for (int i = 0; i < categories.size(); i++) {
				if (categories.get(i).getLevel() == 1) {
					if (count > 0) {
			%>		
				</h2>
			</div>
			<%
					} 
			%>
			<div class="<%=count%2==0? "lft_cat" : "rgt_cat" %>">
				<h1><a href="/category/<%=categories.get(i).getAlias() %>-<%=categories.get(i).getId()%>"><%=categories.get(i).getName() %></a></h1>
				<h2>
			<%  
					count ++;
					num = 0;
				} else {
					num++;
					if (num <= 3) {
			%>
					<a href="/category/<%=categories.get(i).getAlias() %>-<%=categories.get(i).getId()%>"><%=categories.get(i).getName() %></a><%=num < 3 ? ", " : "..." %>
			<% 
					}
				 } 
			} %>
				</h2>
			</div>
			
			<div class="clear"></div>
		</div>
		<br />
<jsp:include page="/templates/classic/layouts/footer.jsp" />